package com.xxxx.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxxx.server.pojo.AdminRole;
import com.xxxx.server.mapper.AdminRoleMapper;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.service.IAdminRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoubin
 * @since 2022-04-13
 */
@Service
public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole> implements IAdminRoleService {
    @Autowired
    private AdminRoleMapper adminRoleMapper;
    @Override
    public RespBean updateadminrole(Integer adminid, Integer[] rids) {
        adminRoleMapper.delete(new QueryWrapper<AdminRole>().eq("adminId",adminid)) ;
        Integer  result=adminRoleMapper.addadminrole(adminid,rids);
        if (rids.length==result){
            return RespBean.success("更新成功");
        }else{
            return RespBean.error("更新失败");
        }
    }
}
